//
//  LSZSystemNotTableViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/9/12.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZSystemNotTableViewCell.h"

@implementation LSZSystemNotTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        CGFloat height = [LSZSpecialPackaging initWithReturnsthesizeOf:100 :5];

        self.imageViewIcon = [[UIImageView alloc]init];
        self.imageViewIcon.frame = CGRectMake(10, 15, 40, 40);
        [self.imageViewIcon.layer setMasksToBounds:YES];
        [self.imageViewIcon.layer setCornerRadius:self.imageViewIcon.frame.size.height/2];
        [self addSubview:self.imageViewIcon];

        CGFloat heightLab = [LSZSpecialPackaging initWithReturnsthesizeOf:20 :2];

        self.labelContent = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.imageViewIcon.frame)+10, CGRectGetMinY(self.imageViewIcon.frame)-5,ScreenWidth-CGRectGetMaxX(self.imageViewIcon.frame)-20, height-13-CGRectGetMinY(self.imageViewIcon.frame)-15)];
        self.labelContent.textColor = lightColor;
        [LSZSpecialPackaging setAnySizeLabel:self.labelContent :13.5];
        self.labelContent.numberOfLines = 3;
        [self addSubview:self.labelContent];
 
        self.labelTime = [[UILabel alloc]init];
        self.labelTime.frame = CGRectMake(CGRectGetMaxY(self.imageViewIcon.frame)+10, height-10-heightLab, 100, heightLab);
        [LSZSpecialPackaging setAnySizeLabel:self.labelTime :13];
        self.labelTime.textColor = lightColor;
        [self addSubview:self.labelTime];

        self.labelMove = [[UILabel alloc]init];
        self.labelMove.frame = CGRectMake(ScreenWidth-150, height-10-heightLab, 140, heightLab);
        [LSZSpecialPackaging setAnySizeLabel:self.labelMove :13];
        self.labelMove.textColor = lightColor;
        self.labelMove.text = @"点击查看详情>>";
        self.labelMove.textAlignment = NSTextAlignmentRight;
        [self addSubview:self.labelMove];
    }
    return self;
}
-(void)setObtainNotificationDetailsMg:(LSZObtainNotificationDetailsMg *)obtainNotificationDetailsMg
{
    [self.imageViewIcon sd_setImageWithURL:[NSURL URLWithString:obtainNotificationDetailsMg.thumb] placeholderImage:[UIImage imageNamed:@"默认_圆"]];
    self.labelContent.text = obtainNotificationDetailsMg.msg;
    self.labelTime.text = obtainNotificationDetailsMg.add_time;
    if ([obtainNotificationDetailsMg.is_read isEqualToString:@"0"]) {
        self.labelMove.text = @"点击查看详情>>";
    }else{
        self.labelMove.text = @"已读";
    }
    CGFloat font = [LSZSpecialPackaging initWithReturnsthesizeOf:13.5 :0.5];
    CGFloat heightCell = [LSZSpecialPackaging initWithReturnsthesizeOf:100 :5];
    CGFloat height = [LSZSpecialPackaging caculateHeightOfText:ScreenWidth-70  height:heightCell-38  font:font :obtainNotificationDetailsMg.msg]-10;
    CGRect rect = self.labelContent.frame;
    rect.size.height = height;
    self.labelContent.frame = rect;
}
@end
